<div class="block_container">
<?php
foreach($picture_list as $row){
?>
<div title="1" class="blockimage <?php if(in_array($row['id'], $pictures_of_folder)) echo 'bgimage';?>" id="<?php echo $row['id'];?>">
                <div class="image">
                <img class="mainimage" title="<?php echo $row['description'];?>" id="img_<?php echo $row['id'];?>" src="<?php echo base_url();?>public/upload/fix/<?php echo $row['url'];?>">
               </div>
                <div class="action">
                    <img class="action_button" onclick="thickBoxPopup(<?php echo $row['id'];?>,<?php echo $start?>,<?php echo $folder_id?>)" src="<?php echo base_url();?>public/skin/back-end/images/icon_edit.gif"> 
                    <img class="action_button" onclick="deleteImages(<?php echo $row['id'];?>)" src="<?php echo base_url();?>public/skin/back-end/images/icon_delete.gif">
                </div>
            </div>
<?php }?>
</div>
<div class="pagination"><?php echo $pagination;?></div>
<div style="clear:both">&nbsp;</div>
<script type="text/javascript">
      $(document).ready(function() {
          $('.image').click(function(){
              picture_id = $(this).parent().attr('id');
              if($(this).parent().hasClass('bgimage')){
            	  $(this).parent().removeClass('bgimage');
            	  ajaxPicture2Folder(picture_id, 'remove');
              }	
              else{
                  $(this).parent().addClass('bgimage');
              	  ajaxPicture2Folder(picture_id, 'add');
              }	  
          });
      });
</script>